package com.yale.cxfsoapws.service.impl;

import com.yale.cxfsoapws.model.User;
import com.yale.cxfsoapws.service.DifferentNameSpaceService;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author yale
 * @date 2017/10/20
 * @version 1.0
 */
public class DifferentNameSpaceServiceImpl implements DifferentNameSpaceService {

    private Map<Long, User> userMap = new HashMap<Long, User>();

    public DifferentNameSpaceServiceImpl(){
        User user = new User();
        user.setUserId(10001L);
        user.setUsername("yale1@qq.com");
        user.setGmtCreate(new Date());
        userMap.put(user.getUserId(), user);

        user = new User();
        user.setUserId(10002L);
        user.setUsername("yale2@qq.com");
        user.setGmtCreate(new Date());
        userMap.put(user.getUserId(), user);

        user = new User();
        user.setUserId(10003L);
        user.setUsername("yale3@qq.com");
        user.setGmtCreate(new Date());
        userMap.put(user.getUserId(), user);
    }

    @Override
    public String getName(Long userId) {
        System.out.println("diffService 1");
        return "yale_" + userId;
    }

    @Override
    public User getUser(Long userId) {
        System.out.println("diffService 2");
        return userMap.get(userId);
    }

}
